(function(){"use strict";BX.namespace("BX.Landing");BX.Landing.NavbarScrollSpy=function(){this.links={};this.targets=[];this.onScreen=[];this.forceHighlightId=null;this.observer=new IntersectionObserver(BX.Landing.NavbarScrollSpy.onIntersection,{threshold:[.5,1]})};BX.Landing.NavbarScrollSpy.CLASS_TO_SET_ACTIVE="nav-item";BX.Landing.NavbarScrollSpy.ACTIVE_CLASS="active";BX.Landing.NavbarScrollSpy.getInstance=function(){return this.instance||(this.instance=new BX.Landing.NavbarScrollSpy)};BX.Landing.NavbarScrollSpy.init=function(n){var i=BX.Landing.NavbarScrollSpy.getInstance();i.add(n)};BX.Landing.NavbarScrollSpy.onIntersection=function(n){var i=BX.Landing.NavbarScrollSpy.getInstance();n.forEach((function(n){i.checkOnScreen(n)}));i.highlight()};BX.Landing.NavbarScrollSpy.getNodeToHighlight=function(n){var i=BX.findParent(n,{class:BX.Landing.NavbarScrollSpy.CLASS_TO_SET_ACTIVE});return i?i:n};BX.Landing.NavbarScrollSpy.prototype={add:function(n){var i=[].slice.call(n.querySelectorAll("a"));i.forEach((function(n){if(n.getAttribute("href")!=="#"&&n.hash!==""&&(n.target===""||n.target==="_self")&&n.pathname===document.location.pathname&&n.hostname===document.location.hostname){try{var i=document.querySelector(n.hash)}catch(n){}if(i){if(typeof this.links[n.hash]==="undefined"){this.links[n.hash]=[]}this.links[n.hash].push(n);this.targets.push(i);this.observer.observe(i);n.addEventListener("click",BX.delegate((function(i){i.preventDefault();i.target.blur();this.forceHighlightId=n.hash;this.unhighlight();this.highlightOnce(n.hash)}),this))}}}),this)},checkOnScreen:function(n){var i=this.onScreen.indexOf(n.target);if(n.isIntersecting&&i===-1){this.onScreen.push(n.target)}else if(!n.isIntersecting&&i!==-1){this.onScreen.splice(i,1)}if(this.forceHighlightId==="#"+n.target.id&&!n.isIntersecting){this.forceHighlightId=null}},highlight:function(){if(this.forceHighlightId!==null){return}this.unhighlight();var n;var i;this.onScreen.forEach((function(t){if(i===undefined){i=t.offsetTop}if(t.offsetTop<=i){i=t.offsetTop;n="#"+t.id}}),this);if(typeof n!=="undefined"&&typeof this.links[n]!=="undefined"&&this.links[n].length>0){this.highlightOnce(n)}},unhighlight:function(){for(var n in this.links){this.unhighlightOnce(n)}},highlightOnce:function(n){this.links[n].forEach((function(n){BX.Landing.NavbarScrollSpy.getNodeToHighlight(n).classList.add(BX.Landing.NavbarScrollSpy.ACTIVE_CLASS)}))},unhighlightOnce:function(n){this.links[n].forEach((function(n){BX.Landing.NavbarScrollSpy.getNodeToHighlight(n).classList.remove(BX.Landing.NavbarScrollSpy.ACTIVE_CLASS)}),this)}}})();
//# sourceMappingURL=scrollspy.map.js